package cn.wolfcode.p2p.base.controller;

import cn.wolfcode.p2p.base.query.AuthQueryObject;
import cn.wolfcode.p2p.base.service.IRealAuthSevice;
import cn.wolfcode.p2p.util.JSONResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 后台真实认证
 */
@Controller
public class RealAuthAuditController {
    @Autowired
    private IRealAuthSevice realAuthSevice;

    @RequestMapping("realAuth")
    public String query(@ModelAttribute("qo")AuthQueryObject qo, Model model){
        model.addAttribute("pageResult",realAuthSevice.query(qo));
        return "realAuth/list";
    }

    /**
     * 实名认证审核
     * @param id 实名认证对象id
     * @param state 认证的结果
     * @param remark 备注
     * @return
     */
    @RequestMapping("realAuth_audit")
    @ResponseBody
    public Object audit(Long id,Integer state,String remark){
        realAuthSevice.audit(id,state,remark);
        return JSONResultUtil.jsonResult();
    }


}

